package com.cn.demo4.controller;

import com.alibaba.fastjson.JSONObject;
import com.cn.demo4.entity.OnlineEntity;
import com.cn.demo4.service.IOnlineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@Controller
@RequestMapping("/admin/online")
public class OnlineController {
    @Autowired
    private IOnlineService iOnlineService;
    @RequestMapping("/findAll")
    public void findAll(HttpServletResponse resp) throws IOException{
        List<OnlineEntity> list = iOnlineService.findAll();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list",list);
        resp.getWriter().println(jsonObject);
    }

}
